package com.working.home.init

import android.content.Context
import androidx.navigation.fragment.fragment
import androidx.startup.Initializer
import com.alibaba.android.arouter.launcher.ARouter
import com.working.home.R
import com.working.home.di.homeModule
import com.working.home.ui.HomeFragment
import com.working.libbase.initializer.AppInitializer
import com.working.libbase.initializer.ApplicationProvider
import org.koin.core.context.loadKoinModules

class ModuleInitializer : Initializer<Unit> {

    override fun create(context: Context) {
        val applicationProvider = ARouter.getInstance().navigation(ApplicationProvider::class.java)
        applicationProvider.addDestination {
            this.fragment<HomeFragment>(R.id.tab_home)
        }
        applicationProvider.addMenu {
            add(0, R.id.tab_home, 0, "首页").setIcon(R.drawable.home_ic_action_home)
        }
        loadKoinModules(homeModule)
    }

    override fun dependencies(): MutableList<Class<out Initializer<*>>> =
        mutableListOf(AppInitializer::class.java)

}